package com.uniflow.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;
import java.util.*;

/**
 * 第三方集成实体类
 */
@ApiModel("第三方集成")
@TableName("third_party_integration")
public class ThirdPartyIntegration {
    
    @ApiModelProperty("集成ID")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    
    @ApiModelProperty("集成名称")
    private String name;
    
    @ApiModelProperty("集成描述")
    private String description;
    
    @ApiModelProperty("集成类型")
    private String integrationType;
    
    @ApiModelProperty("第三方系统类型")
    private String systemType;
    
    @ApiModelProperty("第三方系统名称")
    private String systemName;
    
    @ApiModelProperty("第三方系统版本")
    private String systemVersion;
    
    @ApiModelProperty("连接配置JSON")
    private String connectionConfigJson;
    
    @ApiModelProperty("认证配置JSON")
    private String authConfigJson;
    
    @ApiModelProperty("API配置JSON")
    private String apiConfigJson;
    
    @ApiModelProperty("映射配置JSON")
    private String mappingConfigJson;
    
    @ApiModelProperty("同步配置JSON")
    private String syncConfigJson;
    
    @ApiModelProperty("通知配置JSON")
    private String notificationConfigJson;
    
    @ApiModelProperty("集成状态")
    private String status;
    
    @ApiModelProperty("连接状态")
    private String connectionStatus;
    
    @ApiModelProperty("最后连接时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastConnectedTime;
    
    @ApiModelProperty("最后同步时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastSyncTime;
    
    @ApiModelProperty("同步频率")
    private String syncFrequency;
    
    @ApiModelProperty("自动同步")
    private Boolean autoSync;
    
    @ApiModelProperty("双向同步")
    private Boolean bidirectionalSync;
    
    @ApiModelProperty("实时同步")
    private Boolean realtimeSync;
    
    @ApiModelProperty("优先级")
    private Integer priority;
    
    @ApiModelProperty("超时时间（秒）")
    private Integer timeout;
    
    @ApiModelProperty("重试次数")
    private Integer retryCount;
    
    @ApiModelProperty("重试间隔（秒）")
    private Integer retryInterval;
    
    @ApiModelProperty("批处理大小")
    private Integer batchSize;
    
    @ApiModelProperty("并发数")
    private Integer concurrency;
    
    @ApiModelProperty("限流配置")
    private String rateLimitConfig;
    
    @ApiModelProperty("错误处理策略")
    private String errorHandlingStrategy;
    
    @ApiModelProperty("数据验证规则")
    private String validationRules;
    
    @ApiModelProperty("数据转换规则")
    private String transformationRules;
    
    @ApiModelProperty("过滤条件")
    private String filterConditions;
    
    @ApiModelProperty("集成分类")
    private String category;
    
    @ApiModelProperty("标签")
    private String tags;
    
    @ApiModelProperty("外部ID")
    private String externalId;
    
    @ApiModelProperty("业务键")
    private String businessKey;
    
    @ApiModelProperty("备注")
    private String remark;
    
    @ApiModelProperty("扩展属性JSON")
    private String extendedPropertiesJson;
    
    @ApiModelProperty("排序")
    private Integer sortOrder;
    
    @ApiModelProperty("是否启用")
    private Boolean enabled;
    
    @ApiModelProperty("是否删除")
    @TableLogic
    private Boolean deleted;
    
    @ApiModelProperty("版本号")
    @Version
    private Integer version;
    
    @ApiModelProperty("租户ID")
    private String tenantId;
    
    @ApiModelProperty("创建人ID")
    private String createdBy;
    
    @ApiModelProperty("创建人姓名")
    private String createdByName;
    
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdTime;
    
    @ApiModelProperty("更新人ID")
    private String updatedBy;
    
    @ApiModelProperty("更新人姓名")
    private String updatedByName;
    
    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;
    
    // 非数据库字段
    
    @ApiModelProperty("连接配置对象")
    @TableField(exist = false)
    private Map<String, Object> connectionConfig;
    
    @ApiModelProperty("认证配置对象")
    @TableField(exist = false)
    private Map<String, Object> authConfig;
    
    @ApiModelProperty("API配置对象")
    @TableField(exist = false)
    private Map<String, Object> apiConfig;
    
    @ApiModelProperty("映射配置对象")
    @TableField(exist = false)
    private Map<String, Object> mappingConfig;
    
    @ApiModelProperty("同步配置对象")
    @TableField(exist = false)
    private Map<String, Object> syncConfig;
    
    @ApiModelProperty("通知配置对象")
    @TableField(exist = false)
    private Map<String, Object> notificationConfig;
    
    @ApiModelProperty("扩展属性对象")
    @TableField(exist = false)
    private Map<String, Object> extendedProperties;
    
    @ApiModelProperty("标签列表")
    @TableField(exist = false)
    private List<String> tagList;
    
    @ApiModelProperty("集成历史")
    @TableField(exist = false)
    private List<ThirdPartyIntegrationLog> integrationHistory;
    
    @ApiModelProperty("依赖集成")
    @TableField(exist = false)
    private List<ThirdPartyIntegration> dependentIntegrations;
    
    @ApiModelProperty("连接成功率")
    @TableField(exist = false)
    private Double connectionSuccessRate;
    
    @ApiModelProperty("同步成功率")
    @TableField(exist = false)
    private Double syncSuccessRate;
    
    @ApiModelProperty("平均响应时间")
    @TableField(exist = false)
    private Long avgResponseTime;
    
    @ApiModelProperty("是否可连接")
    @TableField(exist = false)
    private Boolean connectable;
    
    @ApiModelProperty("下次同步时间描述")
    @TableField(exist = false)
    private String nextSyncTimeDesc;
    
    @ApiModelProperty("连接状态描述")
    @TableField(exist = false)
    private String connectionStatusDesc;
    
    // 内部类
    
    /**
     * 同步配置
     */
    public static class SyncConfig {
        private String frequency;
        private Boolean autoSync;
        private Boolean bidirectionalSync;
        private Boolean realtimeSync;
        private String schedule;
        private Map<String, Object> options;
        
        // getter and setter
        public String getFrequency() { return frequency; }
        public void setFrequency(String frequency) { this.frequency = frequency; }
        public Boolean getAutoSync() { return autoSync; }
        public void setAutoSync(Boolean autoSync) { this.autoSync = autoSync; }
        public Boolean getBidirectionalSync() { return bidirectionalSync; }
        public void setBidirectionalSync(Boolean bidirectionalSync) { this.bidirectionalSync = bidirectionalSync; }
        public Boolean getRealtimeSync() { return realtimeSync; }
        public void setRealtimeSync(Boolean realtimeSync) { this.realtimeSync = realtimeSync; }
        public String getSchedule() { return schedule; }
        public void setSchedule(String schedule) { this.schedule = schedule; }
        public Map<String, Object> getOptions() { return options; }
        public void setOptions(Map<String, Object> options) { this.options = options; }
    }
    
    /**
     * 第三方集成日志
     */
    public static class ThirdPartyIntegrationLog {
        private String id;
        private String integrationId;
        private String operationType;
        private String status;
        private String message;
        private LocalDateTime operationTime;
        
        // getter and setter
        public String getId() { return id; }
        public void setId(String id) { this.id = id; }
        public String getIntegrationId() { return integrationId; }
        public void setIntegrationId(String integrationId) { this.integrationId = integrationId; }
        public String getOperationType() { return operationType; }
        public void setOperationType(String operationType) { this.operationType = operationType; }
        public String getStatus() { return status; }
        public void setStatus(String status) { this.status = status; }
        public String getMessage() { return message; }
        public void setMessage(String message) { this.message = message; }
        public LocalDateTime getOperationTime() { return operationTime; }
        public void setOperationTime(LocalDateTime operationTime) { this.operationTime = operationTime; }
    }
    
    // 业务方法
    
    /**
     * 判断是否启用
     */
    public boolean isEnabled() {
        return enabled != null && enabled;
    }
    
    /**
     * 判断是否已连接
     */
    public boolean isConnected() {
        return "CONNECTED".equals(connectionStatus);
    }
    
    /**
     * 判断是否正在同步
     */
    public boolean isSyncing() {
        return "SYNCING".equals(status);
    }
    
    /**
     * 判断是否自动同步
     */
    public boolean isAutoSync() {
        return autoSync != null && autoSync;
    }
    
    /**
     * 判断是否双向同步
     */
    public boolean isBidirectionalSync() {
        return bidirectionalSync != null && bidirectionalSync;
    }
    
    /**
     * 判断是否实时同步
     */
    public boolean isRealtimeSync() {
        return realtimeSync != null && realtimeSync;
    }
    
    /**
     * 获取连接成功率
     */
    public double getConnectionSuccessRateValue() {
        return connectionSuccessRate != null ? connectionSuccessRate : 0.0;
    }
    
    /**
     * 获取同步成功率
     */
    public double getSyncSuccessRateValue() {
        return syncSuccessRate != null ? syncSuccessRate : 0.0;
    }
    
    /**
     * 获取优先级描述
     */
    public String getPriorityDesc() {
        if (priority == null) return "普通";
        switch (priority) {
            case 1: return "低";
            case 2: return "普通";
            case 3: return "高";
            case 4: return "紧急";
            default: return "普通";
        }
    }
    
    /**
     * 获取状态描述
     */
    public String getStatusDesc() {
        if (status == null) return "未知";
        switch (status) {
            case "ACTIVE": return "活跃";
            case "INACTIVE": return "非活跃";
            case "SYNCING": return "同步中";
            case "ERROR": return "错误";
            case "SUSPENDED": return "暂停";
            default: return status;
        }
    }
    
    /**
     * 获取连接状态描述
     */
    public String getConnectionStatusDescription() {
        if (connectionStatus == null) return "未知";
        switch (connectionStatus) {
            case "CONNECTED": return "已连接";
            case "DISCONNECTED": return "已断开";
            case "CONNECTING": return "连接中";
            case "ERROR": return "连接错误";
            case "TIMEOUT": return "连接超时";
            default: return connectionStatus;
        }
    }
    
    /**
     * 获取集成类型描述
     */
    public String getIntegrationTypeDesc() {
        if (integrationType == null) return "未知";
        switch (integrationType) {
            case "API": return "API接口";
            case "DATABASE": return "数据库";
            case "FILE": return "文件";
            case "MESSAGE_QUEUE": return "消息队列";
            case "WEBHOOK": return "Webhook";
            case "FTP": return "FTP";
            case "EMAIL": return "邮件";
            default: return integrationType;
        }
    }
    
    /**
     * 获取系统类型描述
     */
    public String getSystemTypeDesc() {
        if (systemType == null) return "未知";
        switch (systemType) {
            case "CRM": return "客户关系管理";
            case "ERP": return "企业资源规划";
            case "OA": return "办公自动化";
            case "HR": return "人力资源";
            case "FINANCE": return "财务系统";
            case "WAREHOUSE": return "仓库管理";
            case "ECOMMERCE": return "电商平台";
            default: return systemType;
        }
    }
    
    /**
     * 格式化最后连接时间
     */
    public String formatLastConnectedTime() {
        if (lastConnectedTime == null) return "从未连接";
        return lastConnectedTime.toString();
    }
    
    /**
     * 格式化最后同步时间
     */
    public String formatLastSyncTime() {
        if (lastSyncTime == null) return "从未同步";
        return lastSyncTime.toString();
    }
    
    /**
     * 序列化连接配置
     */
    @JsonIgnore
    public void serializeConnectionConfig() {
        if (connectionConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.connectionConfigJson = mapper.writeValueAsString(connectionConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化连接配置
     */
    @JsonIgnore
    public void deserializeConnectionConfig() {
        if (connectionConfigJson != null && !connectionConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.connectionConfig = mapper.readValue(connectionConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.connectionConfig = new HashMap<>();
            }
        } else {
            this.connectionConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化认证配置
     */
    @JsonIgnore
    public void serializeAuthConfig() {
        if (authConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.authConfigJson = mapper.writeValueAsString(authConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化认证配置
     */
    @JsonIgnore
    public void deserializeAuthConfig() {
        if (authConfigJson != null && !authConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.authConfig = mapper.readValue(authConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.authConfig = new HashMap<>();
            }
        } else {
            this.authConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化API配置
     */
    @JsonIgnore
    public void serializeApiConfig() {
        if (apiConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.apiConfigJson = mapper.writeValueAsString(apiConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化API配置
     */
    @JsonIgnore
    public void deserializeApiConfig() {
        if (apiConfigJson != null && !apiConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.apiConfig = mapper.readValue(apiConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.apiConfig = new HashMap<>();
            }
        } else {
            this.apiConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化映射配置
     */
    @JsonIgnore
    public void serializeMappingConfig() {
        if (mappingConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.mappingConfigJson = mapper.writeValueAsString(mappingConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化映射配置
     */
    @JsonIgnore
    public void deserializeMappingConfig() {
        if (mappingConfigJson != null && !mappingConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.mappingConfig = mapper.readValue(mappingConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.mappingConfig = new HashMap<>();
            }
        } else {
            this.mappingConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化同步配置
     */
    @JsonIgnore
    public void serializeSyncConfig() {
        if (syncConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.syncConfigJson = mapper.writeValueAsString(syncConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化同步配置
     */
    @JsonIgnore
    public void deserializeSyncConfig() {
        if (syncConfigJson != null && !syncConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.syncConfig = mapper.readValue(syncConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.syncConfig = new HashMap<>();
            }
        } else {
            this.syncConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化通知配置
     */
    @JsonIgnore
    public void serializeNotificationConfig() {
        if (notificationConfig != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.notificationConfigJson = mapper.writeValueAsString(notificationConfig);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化通知配置
     */
    @JsonIgnore
    public void deserializeNotificationConfig() {
        if (notificationConfigJson != null && !notificationConfigJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.notificationConfig = mapper.readValue(notificationConfigJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.notificationConfig = new HashMap<>();
            }
        } else {
            this.notificationConfig = new HashMap<>();
        }
    }
    
    /**
     * 序列化扩展属性
     */
    @JsonIgnore
    public void serializeExtendedProperties() {
        if (extendedProperties != null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.extendedPropertiesJson = mapper.writeValueAsString(extendedProperties);
            } catch (JsonProcessingException e) {
                // 处理异常
            }
        }
    }
    
    /**
     * 反序列化扩展属性
     */
    @JsonIgnore
    public void deserializeExtendedProperties() {
        if (extendedPropertiesJson != null && !extendedPropertiesJson.isEmpty()) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                this.extendedProperties = mapper.readValue(extendedPropertiesJson, new TypeReference<Map<String, Object>>() {});
            } catch (JsonProcessingException e) {
                this.extendedProperties = new HashMap<>();
            }
        } else {
            this.extendedProperties = new HashMap<>();
        }
    }
    
    /**
     * 解析标签
     */
    @JsonIgnore
    public void parseTags() {
        if (tags != null && !tags.isEmpty()) {
            this.tagList = Arrays.asList(tags.split(","));
        } else {
            this.tagList = new ArrayList<>();
        }
    }
    
    // getter and setter
    
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public String getIntegrationType() { return integrationType; }
    public void setIntegrationType(String integrationType) { this.integrationType = integrationType; }
    public String getSystemType() { return systemType; }
    public void setSystemType(String systemType) { this.systemType = systemType; }
    public String getSystemName() { return systemName; }
    public void setSystemName(String systemName) { this.systemName = systemName; }
    public String getSystemVersion() { return systemVersion; }
    public void setSystemVersion(String systemVersion) { this.systemVersion = systemVersion; }
    public String getConnectionConfigJson() { return connectionConfigJson; }
    public void setConnectionConfigJson(String connectionConfigJson) { this.connectionConfigJson = connectionConfigJson; }
    public String getAuthConfigJson() { return authConfigJson; }
    public void setAuthConfigJson(String authConfigJson) { this.authConfigJson = authConfigJson; }
    public String getApiConfigJson() { return apiConfigJson; }
    public void setApiConfigJson(String apiConfigJson) { this.apiConfigJson = apiConfigJson; }
    public String getMappingConfigJson() { return mappingConfigJson; }
    public void setMappingConfigJson(String mappingConfigJson) { this.mappingConfigJson = mappingConfigJson; }
    public String getSyncConfigJson() { return syncConfigJson; }
    public void setSyncConfigJson(String syncConfigJson) { this.syncConfigJson = syncConfigJson; }
    public String getNotificationConfigJson() { return notificationConfigJson; }
    public void setNotificationConfigJson(String notificationConfigJson) { this.notificationConfigJson = notificationConfigJson; }
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    public String getConnectionStatus() { return connectionStatus; }
    public void setConnectionStatus(String connectionStatus) { this.connectionStatus = connectionStatus; }
    public LocalDateTime getLastConnectedTime() { return lastConnectedTime; }
    public void setLastConnectedTime(LocalDateTime lastConnectedTime) { this.lastConnectedTime = lastConnectedTime; }
    public LocalDateTime getLastSyncTime() { return lastSyncTime; }
    public void setLastSyncTime(LocalDateTime lastSyncTime) { this.lastSyncTime = lastSyncTime; }
    public String getSyncFrequency() { return syncFrequency; }
    public void setSyncFrequency(String syncFrequency) { this.syncFrequency = syncFrequency; }
    public Boolean getAutoSync() { return autoSync; }
    public void setAutoSync(Boolean autoSync) { this.autoSync = autoSync; }
    public Boolean getBidirectionalSync() { return bidirectionalSync; }
    public void setBidirectionalSync(Boolean bidirectionalSync) { this.bidirectionalSync = bidirectionalSync; }
    public Boolean getRealtimeSync() { return realtimeSync; }
    public void setRealtimeSync(Boolean realtimeSync) { this.realtimeSync = realtimeSync; }
    public Integer getPriority() { return priority; }
    public void setPriority(Integer priority) { this.priority = priority; }
    public Integer getTimeout() { return timeout; }
    public void setTimeout(Integer timeout) { this.timeout = timeout; }
    public Integer getRetryCount() { return retryCount; }
    public void setRetryCount(Integer retryCount) { this.retryCount = retryCount; }
    public Integer getRetryInterval() { return retryInterval; }
    public void setRetryInterval(Integer retryInterval) { this.retryInterval = retryInterval; }
    public Integer getBatchSize() { return batchSize; }
    public void setBatchSize(Integer batchSize) { this.batchSize = batchSize; }
    public Integer getConcurrency() { return concurrency; }
    public void setConcurrency(Integer concurrency) { this.concurrency = concurrency; }
    public String getRateLimitConfig() { return rateLimitConfig; }
    public void setRateLimitConfig(String rateLimitConfig) { this.rateLimitConfig = rateLimitConfig; }
    public String getErrorHandlingStrategy() { return errorHandlingStrategy; }
    public void setErrorHandlingStrategy(String errorHandlingStrategy) { this.errorHandlingStrategy = errorHandlingStrategy; }
    public String getValidationRules() { return validationRules; }
    public void setValidationRules(String validationRules) { this.validationRules = validationRules; }
    public String getTransformationRules() { return transformationRules; }
    public void setTransformationRules(String transformationRules) { this.transformationRules = transformationRules; }
    public String getFilterConditions() { return filterConditions; }
    public void setFilterConditions(String filterConditions) { this.filterConditions = filterConditions; }
    public String getCategory() { return category; }
    public void setCategory(String category) { this.category = category; }
    public String getTags() { return tags; }
    public void setTags(String tags) { this.tags = tags; }
    public String getExternalId() { return externalId; }
    public void setExternalId(String externalId) { this.externalId = externalId; }
    public String getBusinessKey() { return businessKey; }
    public void setBusinessKey(String businessKey) { this.businessKey = businessKey; }
    public String getRemark() { return remark; }
    public void setRemark(String remark) { this.remark = remark; }
    public String getExtendedPropertiesJson() { return extendedPropertiesJson; }
    public void setExtendedPropertiesJson(String extendedPropertiesJson) { this.extendedPropertiesJson = extendedPropertiesJson; }
    public Integer getSortOrder() { return sortOrder; }
    public void setSortOrder(Integer sortOrder) { this.sortOrder = sortOrder; }
    public Boolean getEnabled() { return enabled; }
    public void setEnabled(Boolean enabled) { this.enabled = enabled; }
    public Boolean getDeleted() { return deleted; }
    public void setDeleted(Boolean deleted) { this.deleted = deleted; }
    public Integer getVersion() { return version; }
    public void setVersion(Integer version) { this.version = version; }
    public String getTenantId() { return tenantId; }
    public void setTenantId(String tenantId) { this.tenantId = tenantId; }
    public String getCreatedBy() { return createdBy; }
    public void setCreatedBy(String createdBy) { this.createdBy = createdBy; }
    public String getCreatedByName() { return createdByName; }
    public void setCreatedByName(String createdByName) { this.createdByName = createdByName; }
    public LocalDateTime getCreatedTime() { return createdTime; }
    public void setCreatedTime(LocalDateTime createdTime) { this.createdTime = createdTime; }
    public String getUpdatedBy() { return updatedBy; }
    public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; }
    public String getUpdatedByName() { return updatedByName; }
    public void setUpdatedByName(String updatedByName) { this.updatedByName = updatedByName; }
    public LocalDateTime getUpdatedTime() { return updatedTime; }
    public void setUpdatedTime(LocalDateTime updatedTime) { this.updatedTime = updatedTime; }
    public Map<String, Object> getConnectionConfig() { return connectionConfig; }
    public void setConnectionConfig(Map<String, Object> connectionConfig) { this.connectionConfig = connectionConfig; }
    public Map<String, Object> getAuthConfig() { return authConfig; }
    public void setAuthConfig(Map<String, Object> authConfig) { this.authConfig = authConfig; }
    public Map<String, Object> getApiConfig() { return apiConfig; }
    public void setApiConfig(Map<String, Object> apiConfig) { this.apiConfig = apiConfig; }
    public Map<String, Object> getMappingConfig() { return mappingConfig; }
    public void setMappingConfig(Map<String, Object> mappingConfig) { this.mappingConfig = mappingConfig; }
    public Map<String, Object> getSyncConfig() { return syncConfig; }
    public void setSyncConfig(Map<String, Object> syncConfig) { this.syncConfig = syncConfig; }
    public Map<String, Object> getNotificationConfig() { return notificationConfig; }
    public void setNotificationConfig(Map<String, Object> notificationConfig) { this.notificationConfig = notificationConfig; }
    public Map<String, Object> getExtendedProperties() { return extendedProperties; }
    public void setExtendedProperties(Map<String, Object> extendedProperties) { this.extendedProperties = extendedProperties; }
    public List<String> getTagList() { return tagList; }
    public void setTagList(List<String> tagList) { this.tagList = tagList; }
    public List<ThirdPartyIntegrationLog> getIntegrationHistory() { return integrationHistory; }
    public void setIntegrationHistory(List<ThirdPartyIntegrationLog> integrationHistory) { this.integrationHistory = integrationHistory; }
    public List<ThirdPartyIntegration> getDependentIntegrations() { return dependentIntegrations; }
    public void setDependentIntegrations(List<ThirdPartyIntegration> dependentIntegrations) { this.dependentIntegrations = dependentIntegrations; }
    public Double getConnectionSuccessRate() { return connectionSuccessRate; }
    public void setConnectionSuccessRate(Double connectionSuccessRate) { this.connectionSuccessRate = connectionSuccessRate; }
    public Double getSyncSuccessRate() { return syncSuccessRate; }
    public void setSyncSuccessRate(Double syncSuccessRate) { this.syncSuccessRate = syncSuccessRate; }
    public Long getAvgResponseTime() { return avgResponseTime; }
    public void setAvgResponseTime(Long avgResponseTime) { this.avgResponseTime = avgResponseTime; }
    public Boolean getConnectable() { return connectable; }
    public void setConnectable(Boolean connectable) { this.connectable = connectable; }
    public String getNextSyncTimeDesc() { return nextSyncTimeDesc; }
    public void setNextSyncTimeDesc(String nextSyncTimeDesc) { this.nextSyncTimeDesc = nextSyncTimeDesc; }
    public String getConnectionStatusDesc() { return connectionStatusDesc; }
    public void setConnectionStatusDesc(String connectionStatusDesc) { this.connectionStatusDesc = connectionStatusDesc; }
    
    // 添加缺失的方法
    public Map<String, Object> getIntegrationConfigObject() {
        Map<String, Object> config = new HashMap<>();
        config.put("connectionConfig", connectionConfig);
        config.put("authConfig", authConfig);
        config.put("apiConfig", apiConfig);
        config.put("mappingConfig", mappingConfig);
        config.put("syncConfig", syncConfig);
        config.put("notificationConfig", notificationConfig);
        return config;
    }
}